<?php

Route::group(['middleware' => 'web', 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function()
{
	//登录等动作不应该受到守卫的控制
	Auth::routes();

});
Route::group(['middleware' => ['web','auth:admin'], 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function()
{
	//进入后台后的所有操作都应该受到守卫的控制，所以把进入后台后的所有操作都放着这个路由组里
	Route::get('/', 'AdminController@index')->middleware("permission:admin");
	Route::resource('adminuser','AdminUserController')->middleware("permission:admin,resource");
	Route::get('/showpassword','AdminUserController@showPasswordForm');
	Route::post('/resetpassword/{adminid}','AdminUserController@resetPassword');
	Route::resource('role','RoleController')->middleware("permission:admin,resource");
	Route::get('/showrole/{id}','AdminUserController@showrole')->name('showrole')->middleware("permission:admin");
	Route::post('/addrole/{id}','AdminUserController@addrole')->name('addrole')->middleware("permission:admin");
	Route::get('/showpermission/{id}','RoleController@showpermission')->name('showpermission')->middleware("permission:admin");
	Route::post('/addpermission/{roleid}','RoleController@addpermission')->name('addpermission')->middleware("permission:admin");
	Route::get('/module','ModuleController@index')->middleware("permission:admin");
	Route::get('/updateCache','ModuleController@updateCache')->middleware("permission:admin");
	Route::get('/setDefault/{module}','ModuleController@setDefaultModule')->middleware("permission:admin");
	Route::get('/template','TemplateController@index')->middleware("permission:admin");
	Route::get('/setDefaultTp/{tp}','TemplateController@setDefaultTemplate')->middleware("permission:admin");
});
